# TensorFlow Serving部署代码片段
import tensorflow as tf
from tensorflow_serving.apis import prediction_service_pb2_grpc
# 导出SavedModel
tf.saved_model.save(model, "bert_classifier/1/")
# 创建gRPC客户端
channel = grpc.insecure_channel("localhost:8500")
stub = prediction_service_pb2_grpc.PredictionServiceStub(channel)
request = build_request(input_data)
response = stub.Predict(request, timeout=10.0)